
/*
* 
* SHARED FUNCTION
* 
*/
function editor(html,w,h){

    var padding = 25;
    var margin = 15;

    cssWidth = w - ((padding*2)+(margin*2));
    cssHeight = h - ((padding*2)+(margin*2));

    $("#modaleditor").css('width',cssWidth)
    $("#modaleditor").css('height',cssHeight)

    $("#modaleditor").modal({
        opacity: 70,
        containerCss:{
            background: '#003E60',
            border: 0,
            padding: 0,
            width: w,
            height: h
        },
        overlayCss:{
            background: '#000000'
        },
        position: ["7%",''] ,
        onOpen: function (dialog) {
            dialog.overlay.fadeIn('slow', function () {
                dialog.data.hide();
                dialog.container.fadeIn('slow', function () {
                    dialog.data.fadeIn('slow',function(){


                        $('.zmodalClose').fadeIn('fast').delay(118000);

                        $("#modaleditor").html(html);

                        //setTimeout(callback,600);

                    });
                });
            });

        },
        onClose: function (dialog) {

            $.modal.close(); // must call this!

            var timeout = setTimeout("$('#modaleditor').fadeOut();",600);

        }
    })

}

$(function() {



    $('#slider').cycle({
        fx: 'fade',
        speed: 2000,
        timeout: 4000
    });


    $('ul.sf-menu').superfish({ 
        delay:       1000,                            // one second delay on mouseout 
        animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
        speed:       'normal'                         // faster animation speed 
    });    

    if ( $.browser.msie ) {

    } else {
        Cufon.replace('#categorywrap a.naslov,#categorywrap .view-all a, #categorywrap-blog a, .sf-menu a, .noimg a, .itemdescription h1, .itemdescription span, h1');
    }




    //alert(page)
    if(page=='site/home'){
        // CALL SHOW PROMO
        window.setTimeout(function() {  promo_show(); }, 4001);  
    }

    function promo_show(){
        $("#promo_div").modal({

            opacity: 70,
            containerCss:{
                width: '600px',
                height: '800px',
                background: 'transparent',
                border: 0,
                padding: 0
            },
            overlayCss:{
                background: '#000000'
            },
            position: ["7%",] ,
            onOpen: function (dialog) {
                dialog.overlay.fadeIn('slow', function () {
                    dialog.data.hide();
                    dialog.container.fadeIn('slow', function () {
                        dialog.data.slideDown('slow',function(){
                            $('.zmodalClose').fadeIn('fast');
                        });
                    });
                });

            },
            closeClass: 'zmodalClose'
        });
        $('.zmodalClose').css({
            'margin-right':'0',
            'margin-top':'0',
            'display':'none'
        });
    }

}); 